putIfNull

inline fun <D, T> ReadWriteProperty<D, T?>.putIfNull(crossinline default: () -> T): ReadWriteProperty<D, T>

Read from the delegate if non-null, otherwise set the delegate to default and return it.

default will be re-executed each time null is read.

Sources

js source
Link copied to clipboard